A layout approach partitions a plot into a matrix of panels. Each panel shows a different subset of the data.
<!-- Include the CanvasXpress library in your HTML file -->
<link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/>
<script src="https://www.canvasxpress.org/canvasXpress.min.js"></script>
<!-- Create a canvas element for the chart with the desired dimensions -->
<div>
<canvas id="canvasId" width="600" height="600"</canvas>
</div>
<!-- Create a script to initialize the chart -->
<script>
<!-- Create the data for the graph -->
var data = {
"y" : {
"data" : [
[10,8.04],
[8,6.95],
[13,7.58],
[9,8.81],
[11,8.33],
[14,9.96],
[6,7.24],
[4,4.26],
[12,10.84],
[7,4.82],
[5,5.68],
[10,9.14],
[8,8.14],
[13,8.74],
[9,8.77],
[11,9.26],
[14,8.1],
[6,6.13],
[4,3.1],
[12,9.13],
[7,7.26],
[5,4.74],
[10,7.46],
[8,6.77],
[13,12.74],
[9,7.11],
[11,7.81],
[14,8.84],
[6,6.08],
[4,5.39],
[12,8.15],
[7,6.42],
[5,5.73],
[8,6.58],
[8,5.76],
[8,7.71],
[8,8.84],
[8,8.47],
[8,7.04],
[8,5.25],
[19,12.5],
[8,5.56],
[8,7.91],
[8,6.89]
],
"smps" : ["x","y"],
"vars" : ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43"]
},
"z" : {
"dataset" : ["I","I","I","I","I","I","I","I","I","I","I","II","II","II","II","II","II","II","II","II","II","II","III","III","III","III","III","III","III","III","III","III","III","IV","IV","IV","IV","IV","IV","IV","IV","IV","IV","IV"]
}
}
<-- Create the configuration for the graph -->
var config = {
"confidenceIntervalColorCoordinate":"true",
"graphType":"Scatter2D",
"segregateVariablesBy":[
"dataset"
],
"showRegressionFit":"dataset"
}
<!-- Call the CanvasXpress function to create the graph -->
var cX = new CanvasXpress("canvasId", data, config);
</script>
library(canvasXpress)
y=read.table("https://www.canvasxpress.org/data/cX-anscombeQuartet-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
z=read.table("https://www.canvasxpress.org/data/cX-anscombeQuartet-var.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
data=y,
varAnnot=z,
confidenceIntervalColorCoordinate=TRUE,
graphType="Scatter2D",
segregateVariablesBy=list("dataset"),
showRegressionFit="dataset"
)